home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cenvid9.zip / WINSHELL.BAT < prev   
DOS Batch File  |  1994-03-04  |  1KB  |  40 lines

  1. @echo off
  2. :: WinShell.bat - execute windows with the specified shell, where
  3. :: ver.1          the shell is the first argument to WinShell.bat.
  4. ::                Other input parameters are passed to the shell.
  5. ::                This program is to be run from DOS and uses the
  6. ::                DOS version of CEnvi, NOT THE WINDOWS VERSION.
  7. ::
  8. :: Example: Execute AmiPro.exe with the C:\ToDoList.sam document
  9. ::     WinShell c:\AmiPro\AmiPro.exe C:\ToDoList.sam
  10. ::
  11. CEnvi %0.bat %1
  12. GOTO CENVI_EXIT
  13.  
  14. #define SYSTEM_INI "C:\\WIN\\SYSTEM.INI"
  15.  
  16. main(argc,argv)
  17. {
  18.    // the first argument is the shell; or progman if there is no first argument
  19.    ShellName = ( argc < 2 ? "progman" : argv[1] );
  20.  
  21.    // read in all the lines of system.ini
  22.    fp = fopen(SYSTEM_INI,"r");
  23.    assert( fp != NULL );
  24.    for ( Count = 0; NULL != (Line[Count] = fgets(fp)); Count++ ) ;
  25.    fclose(fp);
  26.  
  27.    // write out all of those lines, but substitute the shell= line
  28.    fp = fopen(SYSTEM_INI,"w");
  29.    while( NULL != Line[0] ) {
  30.       if ( !memicmp(Line[0],"shell=",6) )
  31.          sprintf(Line[0]+6,"%s\n",ShellName);
  32.       fputs(Line[0],fp);
  33.       Line++;
  34.    }
  35.    fclose(fp);
  36. }
  37.  
  38. :CENVI_EXIT
  39. win.com %2 %3 %4 %5 %6 %7 %8 %9
  40.